<template>
  <view class="" style="padding-bottom: 40rpx">
    <view class="uni-card paddingL15 cardContent">
      <view class="row title" style="justify-content: flex-start">
        <view style="width: 5px;height: 18px;border-radius: 8rpx;background: #488AFD;margin-right: 20rpx"></view>
        <text style="font-weight: 500">工商司法</text>
      </view>
      <view>
        <view class="row paddingL15 itemTitle">
             <view class="w70">失信被执行条数</view>
               <view class="w30">被执行条数</view>
            </view>
            <view class="row" style="padding: 15rpx">
              <view class="w70 marginL16">{{ gssfInfo.enterpriseDishonestSum != null ?  gssfInfo.enterpriseDishonestSum : '-' }}</view>
              <view class="w30">{{ gssfInfo.executedPersonSum != null ? gssfInfo.executedPersonSum : '-'}}</view>
            </view>
            <view class="row paddingL15 itemTitle">
             <view class="w70">法院公告条数</view>
               <view class="w30">判决文书条数</view>
            </view>
            <view class="row" style="padding: 15rpx">
              <view class="w70 marginL16">{{ gssfInfo.courtNoticeSum != null ? gssfInfo.courtNoticeSum : '-'  }}</view>
              <view class="w30"> {{ gssfInfo.enterpriseCaseSum != null ? gssfInfo.enterpriseCaseSum : '-' }} </view>
            </view>
            <view class="row paddingL15 itemTitle">
             <view class="w70">总涉案金额</view>
               <view class="w30">近6月是否有法人变更</view>
            </view>
            <view class="row" style="padding: 15rpx">
              <view class="w70 marginL16">{{ gssfInfo.subjectAmount !=null ? gssfInfo.subjectAmount : '-'  }}</view>
              <view class="w30">{{ gssfInfo.changeStatus ? '是' : '否' }}</view>
            </view>
      </view>

      <view class="row title" style="justify-content: flex-start">
        <view style="width: 5px;height: 18px;border-radius: 8rpx;background: #488AFD;margin-right: 20rpx"></view>
        <text style="font-weight: 500">工商变更信息</text>
      </view>
      <view style="position:relative;">
        <view v-if="isDemo != ''" style="position:absolute;z-index: 9;left: 50%;top: 50%;transform: translate(-50%,-50%)">
          <image src="/pagesWater/static/waterLogo.png" style="width: 320rpx;height: 200rpx"></image>
        </view>
        <tableData :tableTitleData="tableTitle1" >
          <view style="display: flex" class="data-row" v-for="(item, index) in tableData1" :key="index">
            <view :style="{width: (100 / tableData1.length) + '%'}" class="data-cell">
              <!-- #ifdef MP-TOUTIAO -->
              <uv-read-more :shadowStyle="shadowStyle" textIndent="0" closeText="全部" openText="收起" show-height="100rpx" :toggle="true">
                {{ item.name? item.name : '-'}}
              </uv-read-more>
              <!-- #endif -->
              <!-- #ifdef H5 || APP-PLUS || MP-WEIXIN -->
              <readMore :isPopup="true" :title="tableTitle1[0].title" :showHeight="100" :hideLineNum="2">
                {{item.name ? item.name : '-'}}
                <template #content>
                  <view>{{ item.name.length > 0 ? item.name : "-" }}</view>
                </template>
              </readMore>
              <!-- #endif -->

            </view>
            <view :style="{width: (100 / tableData1.length) + '%'}" class="data-cell">{{ item.changeDate }}</view>
            <view :style="{width: (100 / tableData1.length) + '%'}" class="data-cell">

              <!-- #ifdef H5 || APP-PLUS || MP-WEIXIN -->
              <read-more :isPopup="true" :title="tableTitle1[2].title" :show-height="100" :hide-line-num="2">
                {{ item.beforeContent ? item.beforeContent : '-'}}
                <template #content>
                  <view>{{ item.beforeContent.length > 0 ? item.beforeContent : "-" }}</view>
                </template>
              </read-more>
              <!-- #endif -->
              <!-- #ifdef MP-TOUTIAO -->
              <uv-read-more :shadowStyle="shadowStyle" textIndent="0" closeText="全部" openText="收起" show-height="100rpx" :toggle="true">
                {{ item.beforeContent? item.beforeContent : '-'}}
              </uv-read-more>
              <!-- #endif -->

            </view>
            <view :style="{width: (100 / tableData1.length) + '%'}" class="data-cell">
              <!-- #ifdef H5 || APP-PLUS || MP-WEIXIN -->
              <read-more :isPopup="true" :title="tableTitle1[3].title" :show-height="100" :hide-line-num="2">
                {{ item.affterContent ? item.affterContent : '-' }}
                <template #content>
                  <view>{{ item.affterContent.length > 0 ? item.affterContent : "-" }}</view>
                </template>
              </read-more>
              <!-- #endif -->
              <!-- #ifdef MP-TOUTIAO -->
              <uv-read-more :shadowStyle="shadowStyle" textIndent="0" closeText="全部" openText="收起" show-height="100rpx" :toggle="true">
                {{ item.affterContent? item.affterContent : '-'}}
              </uv-read-more>
              <!-- #endif -->
            </view>
          </view>
          <view v-if="JSON.stringify(tableData1)=='[]'" style="text-align: center;line-height: 100rpx;height: 100rpx;font-size: 26rpx;color: #888888">
            暂无数据
          </view>
        </tableData>
      </view>


      <view class="row title" style="justify-content: flex-start">
        <view style="width: 5px;height: 18px;border-radius: 8rpx;background: #488AFD;margin-right: 20rpx"></view>
        <text style="font-weight: 500">判决文书</text>
      </view>
      <view style="position: relative">
        <view v-if="isDemo != ''" style="position:absolute;z-index: 9;left: 50%;top: 50%;transform: translate(-50%,-50%)">
          <image src="/pagesWater/static/waterLogo.png" style="width: 320rpx;height: 200rpx"></image>
        </view>
        <tableData :tableTitleData="tableTitle2" >
          <view style="display: flex" class="data-row" v-for="(item, index) in tableData2" :key="index">
            <view :style="{width: (100 / tableData2.length) + '%'}" class="data-cell">
               <!-- #ifdef H5 || APP-PLUS || MP-WEIXIN -->
               <readMore :isPopup="true" :title="tableTitle2[2].title" :show-height="100" :hide-line-num="2">
                {{ item.name ? item.name : '-'}}
                <template #content>
                  <view>{{ item.name.length > 0 ? item.name : "-" }}</view>
                </template>
              </readMore>
              <!-- #endif -->
              <!-- #ifdef MP-TOUTIAO -->
              <uv-read-more :shadowStyle="shadowStyle" textIndent="0" closeText="全部" openText="收起" show-height="100rpx" :toggle="true">
                {{ item.name? item.name : '-'}}
              </uv-read-more>
              <!-- #endif -->
            </view>
            <!-- <view :style="{width: (100 / tenCustable.length) + '%'}" class="data-cell" style="justify-content: flex-start">{{ item.month }}</view> -->
            <view :style="{width: (100 / tableData2.length) + '%'}" class="data-cell">{{ item.reason }}</view>
            <view :style="{width: (100 / tableData2.length) + '%'}" class="data-cell">
              <!-- #ifdef H5 || APP-PLUS || MP-WEIXIN -->
              <readMore :isPopup="true" :title="tableTitle2[2].title" :show-height="100" :hide-line-num="2">
                {{ item.roleType ? item.roleType : '-'}}
                <template #content>
                  <view>{{ item.roleType.length > 0 ? item.roleType : "-" }}</view>
                </template>
              </readMore>
              <!-- #endif -->
              <!-- #ifdef MP-TOUTIAO -->
              <uv-read-more :shadowStyle="shadowStyle" textIndent="0" closeText="全部" openText="收起" show-height="100rpx" :toggle="true">
                {{ item.roleType? item.roleType : '-'}}
              </uv-read-more>
              <!-- #endif -->
              <!-- {{ item.roleType }} -->

            </view>
            <view :style="{width: (100 / tableData2.length) + '%'}" class="data-cell">{{ item.judgeDate }}</view>
          </view>
          <view v-if="JSON.stringify(tableData2)=='[]'" style="text-align: center;line-height: 100rpx;height: 100rpx;font-size: 26rpx;color: #888888">
            暂无数据
          </view>
        </tableData>
      </view>

    </view>
    <loading :show="loading"></loading>
  </view>
</template>
<script>
import { getCompanyInfoApi } from '@/api/taxDetail';
import tableData from "@/components/tableData.vue";
import {gssfInfo} from '../../options'
import readMore from '@/components/xzj-readMore.vue'
export default {
    components: {
      tableData,
      readMore
  },
  props: {
    shareCode: {
      type: String,
      default: ''
    },
    taskId: {
      type: String,
      default: ''
    },
    isDemo: {
      type: String,
      default: ''
    }
  },
  filters: {
    // (ms:民事 xs:刑事 xz:行政 pc:赔偿 zx:执行 gx: 管辖案件 gsx：国际司法协助案件qsx：区际司法协助案件 other：其他
    typeFlter(type) {
        const objMap= {
            'ms': '民事',
            'xs': '刑事',
            'xz': '行政',
            'pc': '赔偿',
            'zx': '执行',
            'gx': '管辖案件',
            'gsx': '国际司法协助案件',
            'qsx': '区际司法协助案件',
            'other': '其他'
        }
        return objMap[type]
        
      }
  },
  computed: {
    shadowStyle() {
      return {
        // #ifndef APP-NVUE
        backgroundImage: "none",
        // #endif
        // #ifdef APP-NVUE
        // nvue上不支持设置复杂的backgroundImage属性
        backgroundImage: "none",
        // #endif
        backgroundImage: 'none',
        paddingTop: "100px",
        marginTop: "-100px",
      }
    }
  },
  data() {
    return {
      gssfInfo: {},
      loading: false,
      tableTitle1: [
        { title: '变更项目' },
        { title: '变更日期' },
        { title: '变更前内容' },
        { title: '变更后内容' },
      ],
      tableData1: [], //工商变更信息
      tableTitle2: [
        { title: '文书标题' },
        { title: '案由' },
        { title: '案件身份' },
        { title: '案件日期' },
      ],
      tableData2: [], //判决文书
    };
  },
  onReady() {
    
  },
  created() {
    this.loading = true
    if(!this.taskId && !this.shareCode) {
      this.gssfInfo = gssfInfo.data
      this.tableData1 = this.gssfInfo.enterpriseChangeList ? gssfInfo.data.enterpriseChangeList : []
      this.tableData2 = this.gssfInfo.qccEnterpriseCaseList ? gssfInfo.data.qccEnterpriseCaseList : []
      this.loading = false
    } else {
      this.getInfo()
    }

  },
  methods: {
    getInfo() {
        let params = {
          shareCode: this.shareCode,
          taskId: this.taskId
        }
        getCompanyInfoApi(params).then(res=> {
          this.gssfInfo = res.data
          this.tableData1 = res.data.enterpriseChangeList ? res.data.enterpriseChangeList : []
          this.tableData2 = res.data.qccEnterpriseCaseList ? res.data.qccEnterpriseCaseList : []
        }).finally(() => {
          this.loading = false
        })
    }
  }
};
</script>

<style scoped lang="scss">
/deep/ .xzj {
  color: #222222 !important;
}
/deep/ .watchMore {
  margin-top: 0;
  font-size: 24rpx;
}
.w70 {
  width: 55%;
  text-align: left;
  font-size: 24rpx;
  //white-space: nowrap;
}
.w30 {
  width: 45%;
  text-align: left;
  font-size: 24rpx;
  //white-space: nowrap;
}
.marginL16 {
  margin-left: 16rpx
}
.cardContent {
  box-shadow: none;
  padding-top: 20rpx;
  padding-bottom: 20rpx;
  border-radius: 0 0 15rpx 15rpx;
  margin-top: 0;
}
.title {
  //background: #F1F5F9;
  padding-top: 10rpx;
  padding-bottom: 10rpx;
  margin: 10rpx 0;

}
.itemTitle {
  background: #F1F5F9;
  color: #a8a8a8;
  margin-top: 10rpx;
  margin-bottom: 10rpx;
  padding: 10rpx 16rpx;
}


</style>
